#include "sinkform.h"
#include "ui_sinkform.h"
#include <QKeyEvent>
#include <QSerialPort>
#include <QDebug>
#include "uart.h"
sinkForm::sinkForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::sinkForm)
{
    ui->setupUi(this);
/*    this->setStyleSheet("background-color: rgb(0, 186, 238);");
    btnGroup=new QButtonGroup(this);
    btnGroup->setExclusive(false);
    connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
*/
    QImage *img=GetLogo();
    if(img!=NULL)
        ui->label_Logo->setPixmap(QPixmap::fromImage(*img).scaled(ui->label_Logo->size()));

}

void sinkForm::onButtonClicked(QAbstractButton *button)
{
    qDebug()<<button->isChecked();
    qDebug() << QString("Clicked Button : %1").arg(button->text());
}
sinkForm::~sinkForm()
{
    delete ui;
}
void sinkForm::keyPressEvent(QKeyEvent *event)
{
    int key=event->key();
    qDebug()<< key;
//  printf("key= %d\n",key);
    if(key==Qt::Key_F12||key==Qt::Key_Exit)
    {
        if(ShowPreWin())
            this->hide();
    }
    else
        if(ShowWin(key,0))
            this->hide();
}
